﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Lidgren.Network;

namespace CodeGame.Networking.Serverside
{
    class ServerProtocolEntity
    {
        public static void CreateEntity(string id, int x, int y, int angle, string texture, int r, int g, int b)
        {
            NetOutgoingMessage msg = DedicatedServer.CreateMessage(ServerClientNet.EntityCreate);

            msg.Write(id);
            msg.Write(x);
            msg.Write(y);
            msg.Write(angle);
            msg.Write(texture);
            msg.Write(r);
            msg.Write(g);
            msg.Write(b);

            DedicatedServer.SendMessage(msg);
        }

        public static void TeleportEntity(string id, int x, int y, float angle)
        {
            NetOutgoingMessage msg = DedicatedServer.CreateMessage(ServerClientNet.EntityTeleport);

            msg.Write(id);
            msg.Write(x);
            msg.Write(y);
            msg.Write(angle);

            DedicatedServer.SendMessage(msg);
        }

        public static void UpdateEntityVisual(string id, string texture, int r, int g, int b)
        {
            NetOutgoingMessage msg = DedicatedServer.CreateMessage(ServerClientNet.EntityUpdateVisual);

            msg.Write(id);
            msg.Write(texture);
            msg.Write(r);
            msg.Write(g);
            msg.Write(b);

            DedicatedServer.SendMessage(msg);
        }
    }
}
